package com.bms.hystrix.controller.lts;



import com.bms.hystrix.pojo.ShiPinBiao;
import com.bms.hystrix.service.lts.CheckService;
import io.swagger.annotations.*;
import org.springframework.http.MediaType;
import org.springframework.web.bind.annotation.*;
import org.springframework.web.multipart.MultipartFile;

import javax.annotation.Resource;
import javax.servlet.http.HttpServletRequest;
import javax.servlet.http.HttpServletResponse;
import java.io.FileNotFoundException;
import java.util.Map;

/**
 * @author thinknovo
 * @version 1.0
 * @description CheckController.java
 * @date 2021/3/11 9:30
 */
@RestController
@RequestMapping("shiPinBiao")
@Api(value = "(ShiPinBiao)管理", tags = "(ShiPinBiao)管理接口API")
@ApiResponses({
        @ApiResponse(code = 400, message = "请求参数不完整或者错误"),
        @ApiResponse(code = 404, message = "找不到页面"),
        @ApiResponse(code = 405, message = "请求方式不正确，比如后台接收是post，但前端请求的是get"),
        @ApiResponse(code = 406, message = "页面地址和接口名冲突"),
        @ApiResponse(code = 415, message = "请求格式不正确，前端可能没有把请求头修改为json，也可能前端请求的json对象没有转换为字符串"),
        @ApiResponse(code = 500, message = "后台服务逻辑错误")
})
public class CheckController {
    /**
     * 服务对象
     */
    @Resource
    private CheckService checkService;

    /**
     * 通过主键查询单条数据
     *
     * @param page      需要查询的页码
     * @param mingCheng 模糊查询的内容
     * @return 单条数据
     */
    @RequestMapping(value = "chaXunFenYe", method = RequestMethod.GET)
    @ApiOperation(value = "列表查询分页接口", notes = "列表查询分页接口", httpMethod = "GET")
    @ApiImplicitParams({
            @ApiImplicitParam(name = "page", value = "页码", paramType = "query", dataType = "String", required = true),
            @ApiImplicitParam(name = "mingCheng", value = "**名称", paramType = "query", dataType = "String", required = false)
    })
    public Map chaXunFenYe(@RequestParam(name = "page") int page, String mingCheng) {
        return this.checkService.chaXunFenYe(page, mingCheng);
    }


    /**
     * 通过主键删除单条数据
     *
     * @param id 主键
     * @return 单条数据
     */
    @RequestMapping(value = "shanChuById", method = RequestMethod.POST)
    @ApiOperation(value = "根据一个主键删除一条**记录的接口",notes = "根据一个主键删除一条**记录的接口",httpMethod = "POST")
    @ApiImplicitParams({
            @ApiImplicitParam(name = "id",value = "主键",paramType = "query",dataType = "String",required = true),
    })
    public Map shanChuById(@RequestParam("id") String id) {
        return this.checkService.shanChuById(id);
    }

    /**
     * 通过主键更新单条数据
     *
     * @param shiPinBiao 一个数据库对应的POJO数据对象
     * @return 单条数据
     */
    @RequestMapping(value = "gengXinById", method = RequestMethod.POST)
    @ApiOperation(value = "通过主键更新一个**的接口", notes = "通过主键更新一个**的接口", httpMethod = "POST")
    public Map gengXinById(@RequestBody @ApiParam(name = "shiPinBiao", value = "pojo模型", required = true) ShiPinBiao shiPinBiao) {
        return this.checkService.gengXinById(shiPinBiao);
    }

    /**
     * 通过一个pojo对象新增单条数据
     *
     * @param shiPinBiao 一个数据库对应的POJO数据对象
     * @return 返回插入的主键id
     */
    @RequestMapping(value = "xinZeng", method = RequestMethod.POST)
    @ApiOperation(value = "根据完整记录新增一个**的接口", notes = "根据完整记录新增一个**的接口", httpMethod = "POST")
    public Map xinZeng(@RequestBody ShiPinBiao shiPinBiao) throws FileNotFoundException {
        return this.checkService.xinZeng(shiPinBiao);
    }


    /**
     * 通过主键更新播放量
     *
     * @param shiPinBiao 一个数据库对应的POJO数据对象
     * @return 单条数据
     */
    @RequestMapping(value = "boFangLiangById", method = RequestMethod.POST)
    @ApiOperation(value = "通过主键更新播放量的接口", notes = "通过主键更新播放量的接口", httpMethod = "POST")
    public Map<String, Object> boFangLiangById(@RequestBody @ApiParam(name = "shiPinBiao", value = "pojo模型", required = true) ShiPinBiao shiPinBiao) {
        return this.checkService.boFangLiangById(shiPinBiao);
    }

    /**
     * 通过主键更新讨论量
     *
     * @param shiPinBiao 一个数据库对应的POJO数据对象
     * @return 单条数据
     */
    @RequestMapping(value = "taoLunLiangById", method = RequestMethod.POST)
    @ApiOperation(value = "通过主键更新讨论量的接口", notes = "通过主键更新讨论量的接口", httpMethod = "POST")
    public Map<String, Object> taoLunLiangById(@RequestBody @ApiParam(name = "shiPinBiao", value = "pojo模型", required = true) ShiPinBiao shiPinBiao) {
        return this.checkService.taoLunLiangById(shiPinBiao);
    }

    /**
     * 通过主键更新下载量
     *
     * @param shiPinBiao 一个数据库对应的POJO数据对象
     * @return 单条数据
     */
    @RequestMapping(value = "xiaZaiLiangById", method = RequestMethod.POST)
    @ApiOperation(value = "通过主键更新更新下载量的接口", notes = "通过主键更新下载量的接口", httpMethod = "POST")
    public Map<String, Object> xiaZaiLiangById(@RequestBody @ApiParam(name = "shiPinBiao", value = "pojo模型", required = true) ShiPinBiao shiPinBiao) {
        return this.checkService.xiaZaiLiangById(shiPinBiao);
    }

    /**
     * 通过主键更新下载量
     *
     * @param diZhi 一个数据库对应的POJO数据对象
     * @return 单条数据
     */
    @RequestMapping(value = "xiaZaiShiPin", method = RequestMethod.POST)
    @ApiOperation(value = "通过主键更新更新下载量的接口", notes = "通过主键更新下载量的接口", httpMethod = "POST")
    void xiaZaiShiPin(String diZhi) {
        checkService.xiaZaiShiPin(diZhi);
    }
}
